﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Data;
using System.Text;
using System.Web.SessionState;

namespace lcs.Web
{
    /// <summary>
    /// HandlerPic 的摘要说明
    /// </summary>
    public class HandlerPic : IHttpHandler
    {
        BLL.mobileSendInfo bll = new BLL.mobileSendInfo();
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string ac = "";
            if (null != context.Request.Form["action"])
            {//获取前台传来的值  
                ac = context.Request.Form["action"].ToString().Trim();
            }
            else if (null != context.Request.QueryString["action"])
            {
                ac = context.Request.QueryString["action"].ToString().Trim();
            }

            if (ac == "pic")
                Query(context);
        }
        public void Query(HttpContext context)
        {
            string bm = "";
            int keyid = 0;
            if (!string.IsNullOrEmpty(context.Request.QueryString["keyid"]))
            {
                bm = context.Request.QueryString["keyid"].ToString();
                int.TryParse(bm, out keyid);
            }
            context.Response.BinaryWrite(bll.Getpic(keyid));//返回给前台页面  
            context.Response.End();

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}